import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'

Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      name: 'init',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'home',
      component: Home,
      children:[
        {
          path: '',// 默认定向到home路由下的user路由
          redirect: '/home/user'
        },
        {
          path: '/home/user',
          name: 'user',
          // route level code-splitting
          // this generates a separate chunk (home.[hash].js) for this route
          // which is lazy-loaded when the route is visited.
          component: () => import(/* webpackChunkName: "home" */ './views/User')
        },
        {
          path: '/home/prod',
          name: 'prod',
          // route level code-splitting
          // this generates a separate chunk (home.[hash].js) for this route
          // which is lazy-loaded when the route is visited.
          component: () => import(/* webpackChunkName: "home" */ './views/Prod')
        },
        {
          path: '/home/manage',
          name: 'manage',
          // route level code-splitting
          // this generates a separate chunk (home.[hash].js) for this route
          // which is lazy-loaded when the route is visited.
          component: () => import(/* webpackChunkName: "home" */ './views/Manage')
        },
        {
          path: '/home/study',
          name: 'study',
          // route level code-splitting
          // this generates a separate chunk (home.[hash].js) for this route
          // which is lazy-loaded when the route is visited.
          component: () => import(/* webpackChunkName: "home" */ './views/Study')
        },
      ]
    },
    {
      path: '/demo1',
      name: 'demo1',
      // route level code-splitting
      // this generates a separate chunk (demo.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import(/* webpackChunkName: "demo" */ './views/Demo1')
    },
    {
      path: '/demo2',
      name: 'demo2',
      // route level code-splitting
      // this generates a separate chunk (demo.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import(/* webpackChunkName: "demo" */ './views/Demo2')
    },
    {
      path: '/demo3',
      name: 'demo3',
      // route level code-splitting
      // this generates a separate chunk (demo.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import(/* webpackChunkName: "demo" */ './views/Demo3')
    },
    {
      path: '/demo4',
      name: 'demo4',
      // route level code-splitting
      // this generates a separate chunk (demo.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import(/* webpackChunkName: "demo" */ './views/Demo4')
    },
    {
      path: '/demo5',
      name: 'demo5',
      // route level code-splitting
      // this generates a separate chunk (demo.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import(/* webpackChunkName: "demo" */ './views/Demo5')
    },
  ]
})
